#ifndef NGLOBAL_HPP
#define NGLOBAL_HPP

#include <QtGlobal>

/*! Defines the current version of this library in string form */
#define NEON_VER_STR "0.0.1"

/*!
* Defines the current version of this library in integer form.<br>
* 0xMMmmPP<br>
* MM - Major<br>
* mm - Minor<br>
* PP - Patch
*/
#define NEON_VER 0x000001

/*!
* Checks the NEON_VER against a version input.
*/
#define NEON_VER_CHECK(major, minor, patch) \
	((major << 16) | (minor << 8) | (patch))

#ifdef Q_OS_WIN32
#include <windows.h>
#ifdef min
#undef min
#endif // min
#ifdef max
#undef max
#endif // max
#endif // Q_OS_WIN32

#include <GL/glew.h>

#ifdef Q_WS_WIN
#include <GL/wglew.h>
#include <qt_windows.h>
#elif defined(Q_WS_MAC)
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#else
#include <GL/gl.h>
#include <GL/glu.h>
#endif // Q_WS_MAC

/*! Typedef of signed char. This type is guarenteed to be 8-bit on all platforms. */
typedef signed char nint8;
/*! Typedef of signed char. This type is guarenteed to be 8-bit on all platforms. */
typedef nint8 nchar;
/*! Typedef of unsigned char. This type is guarenteed to be 8-bit on all platforms. */
typedef unsigned char nuint8;
/*! Typedef of unsigned char. This type is guarenteed to be 8-bit on all platforms. */
typedef nuint8 nuchar;
/*! Typedef of short. This type is guarenteed to be 16-bit on all platforms. */
typedef short nint16;
/*! Typedef of short. This type is guatenteed to be 16-bit on all platforms. */
typedef nint16 nshort;
/*! Typedef of unsigned short. This type is guarentee to be 16-bit on all platforms. */
typedef unsigned short nuint16;
/*! Typedef of unsigned short. This type is guarentee to be 16-bit on all platforms. */
typedef nuint16 nushort;
/*! Typedef of int. This type is guarentee to be 32-bit on all platforms. */
typedef int nint32;
/*! Typedef of unsigned int. This type is guarentee to be 32-bit on all platforms. */
typedef unsigned int nuint32;

#if defined(Q_CC_MSVC) && !defined(Q_CC_GNU)
/*! Typedef for long long int (__int64 on Windows). This type is guarentee to be 64-bit on all platforms. */
typedef __int64 nint64;
/*! Typedef for unsigned long long int (__int64 on Windows). This type is guarentee to be 64-bit on all platforms. */
typedef __int64 nuint64;
#else
/*! Typedef for long long int (__int64 on Windows). This type is guarentee to be 64-bit on all platforms. */
typedef long long int nint64;
/*! Typedef for unsigned long long int (__int64 on Windows). This type is guarentee to be 64-bit on all platforms. */
typedef unsigned long long int nint64;
#endif // defined(Q_CC_MSVC) && !defined(Q_CC_GNU)

/*! Typedef for long. */
typedef long nlong;
/*! Typedef for unsigned long. */
typedef unsigned long nulong;

/*! Typedef for long long int (__int64 on Windows). See also nint64. */
typedef nint64 nlonglong;
/*! Typedef for unsigned long long int (__int64 on Windows). See also nuint64. */
typedef nuint64 nulonglong;

/*! Typedef for float. */
typedef float nfloat;
/*! Typedef for double. */
typedef double ndouble;
/*! Typedef for long double. */
typedef long double nlongdouble;

#ifndef USE_DOUBLE_PRECISION
/*! Typedef for float if USE_DOUBLE_PRECISION not defined. double if it is. */
typedef nfloat nreal;
#else
/*! Typedef for float if USE_DOUBLE_PRECISION not defined. double if it is. */
typedef ndouble nreal;
#endif // USE_DOUBLE_PRECISION

#if defined(Q_CC_MSVC) && !defined(Q_CC_GNU)
#	define NEON_STATIC static
#	define NEON_INLINE __forceinline
#	define NEON_STATIC_INLINE NEON_STATIC NEON_INLINE
#	define NEON_DEPRECATED(text) __declspec(deprecated(text))
#else
#	define NEON_STATIC static
#	define NEON_INLINE __attribute__(alwaysinline)
#	define NEON_STATIC_INLINE NEON_STATIC NEON_INLINE
#	define NEON_DEPRECATED(text) __attribute__(deprecated)
#endif // defined(Q_CC_MSVC) && !defined(Q_CC_GNU)

#if defined(Q_CC_MSVC) && !defined(Q_CC_GNU)
#	ifdef NEON_BUILD_DLL
#		define NEON_DLL __declspec(dllexport)
#	else
#		define NEON_DLL __declspec(dllimport)
#	endif
#else
#	define NEON_DLL
#endif // defined(Q_CC_MSVC) && !defined(Q_CC_GNU)

/*!
* Unused parameter to help prevent uninitialised variables in function parameters.
*/
#define nUNUSED(x)

#pragma warning(disable: 4305) // truncation from 'double' to const nreal'

#endif // NGLOBAL_HPP
